var assert = require('assert');
var crypto = require('crypto');

function test_des() {
    var key = new Buffer('0123456789abcd0123456789');
    var iv = new Buffer('12345678');
    var plaintext = 'zxw68824';
    var alg = 'des-ede3-cbc';

    //加密 
    var cipher = crypto.createCipheriv(alg, key, iv);
    var ciph = cipher.update(plaintext, 'utf8', 'hex');
    ciph += cipher.final('hex');
    console.log(alg, ciph);

    //解密 
    var decipher = crypto.createDecipheriv(alg, key, iv);
    var txt = decipher.update(ciph, 'hex', 'utf8');
    txt += decipher.final('utf8');
    console.log(txt);
}

test_des();